package banwood.com.xiongfasy.adapter;

import java.util.List;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import banwood.com.xiongfasy.R;
import banwood.com.xiongfasy.bean.BillBean;

public class BillAdapter extends BaseAdapter {

    private Context mContext;
    private List<BillBean> mDatas;

    public BillAdapter(Context context, List<BillBean> list) {
        super();
        this.mContext = context;
        this.mDatas = list;
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public Object getItem(int arg0) {
        return null;
    }

    @Override
    public long getItemId(int arg0) {
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {

        ViewHolder holder = null;
        if (view == null) {
            holder = new ViewHolder();
            view = LayoutInflater.from(mContext).inflate(R.layout.bill_item, null);
            holder.liushuihao = (TextView) view.findViewById(R.id.bill_item_liushuihao);
            holder.time = (TextView) view.findViewById(R.id.bill_item_time);
            holder.user = (TextView) view.findViewById(R.id.bill_item_user);
            holder.money = (TextView) view.findViewById(R.id.bill_item_money);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }

        holder.liushuihao.setText(mDatas.get(position).getOrder());
        holder.time.setText(mDatas.get(position).getTime());
        holder.user.setText(mDatas.get(position).getUser());
        holder.money.setText(mDatas.get(position).getMoney());

        return view;
    }


    class ViewHolder {
        TextView liushuihao;
        TextView time;
        TextView user;
        TextView money;
    }

}
